﻿' LibWowArmory
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports System.Collections.Generic

Namespace roncliProductions.LibWowArmory

    ''' <summary>
    ''' A class that stores a single faction's reputation information
    ''' </summary>
    ''' <remarks></remarks>
    Public Class Reputation

        Private intID As Integer
        Private strName As String
        Private intReputation As Integer
        Private rReputations As New List(Of Reputation)

        ''' <summary>
        ''' The ID number of the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ID() As Integer
            Get
                Return intID
            End Get
            Set(ByVal value As Integer)
                intID = value
            End Set
        End Property

        ''' <summary>
        ''' The name of the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Name() As String
            Get
                Return strName
            End Get
            Set(ByVal value As String)
                strName = value
            End Set
        End Property

        ''' <summary>
        ''' The reputations that this faction is a parent of
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Reputations() As List(Of Reputation)
            Get
                Return rReputations
            End Get
            Set(ByVal value As List(Of Reputation))
                rReputations = value
            End Set
        End Property

        ''' <summary>
        ''' The total reputation gained for the faction
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property TotalReputation() As Integer
            Get
                Return intReputation
            End Get
            Set(ByVal value As Integer)
                intReputation = value
            End Set
        End Property

        ''' <summary>
        ''' The reputation's status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Status() As String
            Get
                Select Case intReputation
                    Case -42000 To -6001
                        Return "Hated"
                    Case -6000 To -3001
                        Return "Hostile"
                    Case -3000 To -1
                        Return "Unfriendly"
                    Case 0 To 2999
                        Return "Neutral"
                    Case 3000 To 8999
                        Return "Friendly"
                    Case 9000 To 20999
                        Return "Honored"
                    Case 21000 To 41999
                        Return "Revered"
                    Case 42000 To 42999
                        Return "Exalted"
                    Case Integer.MinValue
                        Return "None"
                    Case Else
                        Return "Unknown"
                End Select
            End Get
        End Property

        ''' <summary>
        ''' The reputation gained within the current status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Reputation() As Integer?
            Get
                Select Case intReputation
                    Case -42000 To -6001
                        Return intReputation + 42000
                    Case -6000 To -3001
                        Return intReputation + 6000
                    Case -3000 To -1
                        Return intReputation + 3000
                    Case 0 To 2999
                        Return intReputation
                    Case 3000 To 8999
                        Return intReputation - 3000
                    Case 9000 To 20999
                        Return intReputation - 9000
                    Case 21000 To 41999
                        Return intReputation - 21000
                    Case 42000 To 42999
                        Return intReputation - 42000
                    Case Else
                        Return 0
                End Select
            End Get
        End Property

        ''' <summary>
        ''' The max reputation for the current status
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property MaxReputation() As Integer?
            Get
                Select Case intReputation
                    Case -42000 To -6001
                        Return 36000
                    Case -6000 To 2999
                        Return 3000
                    Case 3000 To 8999
                        Return 6000
                    Case 9000 To 20999
                        Return 12000
                    Case 21000 To 41999
                        Return 21000
                    Case 42000 To 42999
                        Return 1000
                    Case Else
                        Return 0
                End Select
            End Get
        End Property

        ''' <summary>
        ''' A constructor to create new reputation information
        ''' </summary>
        ''' <param name="intID"></param>
        ''' <param name="strName"></param>
        ''' <param name="intReputation"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal intID As Integer, ByVal strName As String, ByVal intReputation As Integer)
            Me.intID = intID
            Me.strName = strName
            Me.intReputation = intReputation
        End Sub

    End Class

End Namespace